home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
sap.arc
/
SAMPLE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-04-04
|
1KB
|
64 lines
/*****************************************************************************
*
* Program Name: SAMPLE
*
* Filename: sample.c
*
* Date Created: March 22, 1988
*
* Programmers: Bryan Sparks
*
* Files used: sap.c, comm.h, sapa.asm
*
* Comments: This program demonstrates how to ADVERTISE using
* the Service Advertising Protocol. The functions
* SAP.OBJ and SAPA.OBJ can be "plugged-in" to your
* program to do Service Advertising.
*
****************************************************************************/
main(argc,argv)
int argc;
char *argv[];
{
int ccode;
unsigned int ServerType;
char ServerName[48];
unsigned int ServerSocket=0x1111; /* This would be your socket number. */
switch (argc) {
case 3:
strcpy( ServerName, argv[1] );
ConvertToUpper( ServerName, ServerName );
ServerType = atoi( argv[2] );
break;
default:
printf("\nusage: sap <server_name> <server_type_number>\n\n");
exit (-1);
break;
}
StartSAPOscillationRoutines( ServerName,
ServerType,
ServerSocket );
printf("This machine is now ADVERTISING.\n\nPress any key to quit...");
while (!kbhit())
;
printf("\nCanceling SAP...");
ccode = StopSAPOscillationRoutines( ServerName,
ServerType,
ServerSocket );
if (ccode)
printf("\rHad problems stopping SAP routines.\n");
else
printf("\rSAP routines canceled.\n");
}